#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;
#include<string>
int main()
{
	string s1, st;
	cin >> s1;
	for (auto e : s1)
	{
		if (st.size() && st.back() == e)
		{
			st.pop_back();
		}
		else {
			st += e;
		}
	}
	cout << (st.size() == 0 ? "0" : st) << endl;
	return 0;
}